/*
 * Copyright (c) 2017-2022, Lindenis Tech. Ltd.
 * All rights reserved.
 *
 * File:
 *
 * Description:
 *
 * Author:
 *      xiaoshujun@lindeni.com
 *
 * Create Date:
 *      2022/01/20
 *
 * History:
 *
 */

#ifndef __LIND_AUIDO__
#define __LIND_AUIDO__

#ifdef __cplusplus
extern "C" {
#endif

#include "osal_types.h"
#include "lindcomponent.h"

#define MULTI_AENC_CNT      2

typedef enum
{
    LD_AUDIO_MSG_UNKNOWN        = 0,

    //
    LD_AUDIO_MSG_PCM            = 0x100,
    LD_AUDIO_MSG_AENC           = 0x101,
} mpp_audio_msg_e;

typedef struct _mpp_audio_config_t
{
    /*
     * msg callback
     */
    comm_msg_cb     msg_cb;
    void *          user;

    int             channels;
    int             sample_rate;
    int             bits;
} mpp_audio_config_t;

typedef struct _mpp_aenc_config_t
{
    av_enc_type_t   aenc_type;
    int             mute;   // 1: enable mute, 0: disable mute
} mpp_aenc_config_t;

_handle_t mpp_audio_create(int audio_id, mpp_audio_config_t * p_config);
void mpp_audio_destroy(_handle_t h_audio);

/**
 * callback pcm data to app.
 */
int  mpp_audio_pcm_start(_handle_t h_audio);
void mpp_audio_pcm_stop(_handle_t h_audio);

/**
 * callback audio es data to app.
 */
int  mpp_audio_aenc_set_params(_handle_t h_audio, int index, mpp_aenc_config_t * p_config);
int  mpp_audio_aenc_start(_handle_t h_audio, int index);
void mpp_audio_aenc_stop(_handle_t h_audio, int index);
int  mpp_audio_aenc_set_mute(_handle_t h_audio, int index, int mute);
int  mpp_audio_aenc_get_mute(_handle_t h_audio, int index);

#ifdef __cplusplus
}
#endif

#endif  // __LIND_AUIDO__

